{include file=member.header.html}
{include file="title.html"}
{include file=member.submenu.html}
<script type="text/javascript">
//<!CDATA[

    $(function() {
        sdcategoryInit("sdcategory");
        regionInit("region");
        $('#suplly_demand_form').validate({
            errorPlacement: function(error, element) {
                $(element).after(error);
            },
            rules: {
                cate_id: {
                    required: true
                },
                title: {
                    required: true
                },
                region_id: {
                    required: true
                },
                phone: {
                    required: true
                },
                name: {
                    required: true
                }
            },
            messages: {
                cate_id: {
                    required: '{$lang.cate_not_null}'
                },
                title: {
                    required: '{$lang.title_not_null}'
                },
                region_id: {
                    required: '{$lang.region_not_null}'
                },
                phone: {
                    required: '{$lang.phone_not_null}'
                },
                name: {
                    required: '{$lang.name_not_null}'
                }
            }
        });
        $("[name='type']").change(function() {
            if (this.value == 1) {
                $("[ectype='demand']").hide();
                $("[ectype='supply']").show();
            }
            else {
                $("[ectype='demand']").show();
                $("[ectype='supply']").hide();
            }
        });


    });
//]]>
</script>
<style>
    .form_content li p .sex{width:46%;height:30px;line-height:30px;background:#fff;padding:0 2%;display: block;float:left;}
</style>
{$editor_upload}
{$build_editor}

    <form method="post" id="suplly_demand_form" enctype="multipart/form-data" class="form">
        <ul class="form_content">
            <li>
                <h3>{$lang.type}</h3>
                <p class="clearfix">
                    <label class="sex">
                        <input type="radio" name="type" {if $info.type eq 1 or $info.type eq 0}checked{/if} value="1" />{$lang.supply}
                    </label>
                    <label class="sex">
                        <input type="radio" name="type" value="2" {if $info.type eq 2}checked{/if} />{$lang.demand}
                    </label>
                </p>
            </li>
            <li>
                <h3>{$lang.cate}</h3>
                <p id="sdcategory">
                    <!-- {if $info.cate_id} -->
                    <span  class="tit">{$info.cate_name|escape}</span>
                    <input type="button" value="{$lang.edit}" class="edit_gcategory" />
                    <select style="display:none">
                        <option>{$lang.select_pls}</option>
                        {html_options options=$sdcategories}
                    </select>
                    <!-- {else} -->
                    <select>
                        <option>{$lang.select_pls}</option>
                        {html_options options=$sdcategories}
                    </select>
                    <!-- {/if} -->
                    <input type="hidden" id="cate_id" name="cate_id" value="{$info.cate_id}" class="mls_sdid" />
                    <input type="hidden" id="cate_name" name="cate_name" value="{$info.cate_name}" class="mls_sdnames" />
                </p>
            </li>

            <li>
                <div ectype="demand" style="display:none;">
                    <h3>{$lang.demand_price}:</h3>
                    <p>
                        <input type="text" name="price_from" value="{$info.price_from}" placeholder="{$lang.yuan}" style="width:45%"/>
                        -
                        <input type="text" name="price_to" value="{$info.price_to}" placeholder="{$lang.yuan}" style="width:45%"/>
                    </p>
                </div>
                <div ectype="supply">
                    <h3>{$lang.price}:</h3>
                    <p>
                        <input type="text" name="price" value="{$info.price}" placeholder="{$lang.yuan}" />
                    </p>
                </div>
            </li>

            <li>
                <h3>{$lang.title}:</h3>
                <p>
                    <input type="text" name="title" value="{$info.title|escape}"  placeholder="* {$lang.must_fill_in}"/>
                </p>
            </li>

            <li>
                <h3>{$lang.region}:</h3>
                <p id="region">
                    <!-- {if $info.region_id} -->
                    <span class="tit">{$info.region_name|escape}</span>
                    <input type="button" value="{$lang.edit}" class="edit_region" />
                    <select style="display:none">
                        <option>{$lang.select_pls}</option>
                        {html_options options=$regions}
                    </select>
                    <!-- {else} -->
                    <select>
                        <option>{$lang.select_pls}</option>
                        {html_options options=$regions}
                    </select>
                    <!-- {/if} -->
                    <input type="hidden" name="region_id" value="{$info.region_id}" class="mls_id" />
                    <input type="hidden" name="region_name" value="{$info.region_name|escape}" class="mls_names" />
                </p>
            </li>
            <li>
                <h3>{$lang.phone}</h3>
                <p>
                    <input type="text" name="phone" value="{$info.phone|escape}" placeholder="* {$lang.must_fill_in}"/>
                </p>
            </li>
            <li>
                <h3>{$lang.name}</h3>
                <p>
                    <input type="text" name="name" value="{$info.name|escape}" placeholder="* {$lang.must_fill_in}"/>
                </p>
            </li>
            <li>
                <h3>{$lang.details}</h3>
                <p style="width:100%;overflow: scroll">
                    <textarea name="content" id="description"  style="width:100%; height:300px;">
				{$info.content|escape}
                    </textarea>
                </p>
            </li>
            <li>
                <input class="red_btn" type="submit" value="{$lang.submit}" />
            </li>
        </ul>
        
    </form>

{include file=footer.html}